package cn.crc.pjblog.pages.test;

import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.annotations.Retain;
import org.apache.tapestry5.beaneditor.BeanModel;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.services.BeanModelSource;

public class BeanEditForm {
	
	@Inject
	private BeanModelSource beanModelSource;
	
	@Retain 
	private BeanModel model;
	
	@Inject 
	private ComponentResources resources;
	
	private MyBean bean;

	void pageLoaded(){
		
		this.getBeanModelSource().create(MyBean.class, true, resources);
	}
	
		
	/**
	 * @return the bean
	 */
	public MyBean getBean() {
		return bean;
	}

	/**
	 * @return the beanModelSource
	 */
	public BeanModelSource getBeanModelSource() {
		return beanModelSource;
	}

	/**
	 * @return the model
	 */
	public BeanModel getModel() {
		return model;
	}

	/**
	 * @param bean the bean to set
	 */
	public void setBean(MyBean bean) {
		this.bean = bean;
	}

	/**
	 * @param beanModelSource the beanModelSource to set
	 */
	public void setBeanModelSource(BeanModelSource beanModelSource) {
		this.beanModelSource = beanModelSource;
	}

	/**
	 * @param model the model to set
	 */
	public void setModel(BeanModel model) {
		this.model = model;
	}


	/**
	 * @return the resources
	 */
	public ComponentResources getResources() {
		return resources;
	}


	/**
	 * @param resources the resources to set
	 */
	public void setResources(ComponentResources resources) {
		this.resources = resources;
	}
	
	
	
	
}
